<style>
    table tr{
        height: 32px;
    }
    .switch{
        width: 28px;
        height: 14px;
    }
    .switch small{
        width: 14px;
        height: 14px;
    }
    .switch.checked small{
        left: 13px;
    }
</style>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header" style="margin-top:1px;">
                   
                    <form name="mainForm" ng-submit="save(mainForm.$valid);">
                        <input type="submit" class="btn btn-info" ng-disabled="runIng" value="保存配置" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="button" class="btn btn-info" ng-click="goBack();" ng-disabled="runIng" value="返回" />
                        <br>
                        <br>
                        <uib-accordion close-others="false">
                            <uib-accordion-group heading="Project Info" is-open="true">
                                <input type="radio" value="0" name="projectType" ng-disabled="projectName != '' || !canAddTrunk();" ng-click="proTypeChange();" ng-model="info.projectType" />&nbsp;&nbsp;主干工程 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="radio" value="1" name="projectType" ng-disabled="projectName != ''" ng-click="proTypeChange();" ng-model="info.projectType" />&nbsp;&nbsp;分支工程
                                <span ng-show="projectName == '' && !canAddTrunk()" style="color: red;margin-left: 20%;">系统管理员可以添加主干工程.如果要添加主干工程,请联系管理员或者使用有管理员权限的账号添加.</span>
                                <br>
                                <table width="95%">
                                    <thead>
                                        <tr>
                                            <th width="20%"></th>
                                            <th width="40%"></th>
                                            <th width="40%"></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>工程类型：</td>
                                            <td>
                                                <div class="row">
                                                    <div class="col-xs-6" style="width: 40%;">
                                                        <select class="form-control" ng-disabled=" info.projectType == '1' || projectName != '' " ng-model="projectInfo.packageType" ng-change="packageTypeChange();">
                                                            <option value="maven_war">maven_war</option>
                                                            <option value="maven_jar">maven_jar</option>
                                                            <option value="php">php</option>
                                                            <option value="ant_android">ant_android</option>
                                                            <option value="spring_boot_jar">spring_boot_jar</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr ng-show=" info.projectType == '1' ">
                                            <td><span style="color: red;">(必填)</span>主干工程：</td>
                                            <td>
                                                <div class="row">
                                                    <div class="col-xs-6">
                                                        <select class="form-control" ng-disabled="projectName != ''" ng-model="projectInfo.trunkProject" ng-change="trunkChange();" ng-options="i.projectName as i.projectName for i in trunkProjectList"></select>
                                                    </div>
                                                </div>
                                            </td>
                                            <td><span style="color: red;">当前要添加的分支工程对应的主干工程</span></td>
                                        </tr>
                                        <tr>
                                            <td><span style="color: red;">(必填)</span>工程名：</td>
                                            <td>
                                                <span ng-show=" info.projectType == '1' ">{{projectInfo.trunkProject}}_</span>
                                                <input type="text" ng-model="projectInfo.branchName" required ng-show="projectName == ''" />
                                                <span ng-show="projectName != ''">{{projectInfo.branchName}}</span>
                                            </td>
                                            <td><span style="color: red;">要添加的工程名称</span></td>
                                        </tr>
                                        <tr ng-if="projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar' || projectInfo.packageType == 'php'">
                                            <td><span style="color: red;">(必填)</span>环境配置工程名：</td>
                                            <td>
                                                <input type="text" ng-if=" info.projectType == '0'" required ng-model="projectInfo.configProjectName" />
                                                <span ng-show=" info.projectType == '1' ">{{projectInfo.configProjectName}}</span>
                                            </td>
                                            <td><span style="color: red;">svn的环境配置文件目录下，当前工程对应的目录名称</span></td>
                                        </tr>
                                        <tr>
                                            <td>工程svn地址：</td>
                                            <td>
                                                <input type="text" ng-model="projectInfo.vcsPath" style="width:500px;" />
                                            </td>
                                        </tr>
                                        <tr ng-if="projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar' || projectInfo.packageType == 'maven_jar'">
                                            <td><span ng-if="projectInfo.packageType == 'maven_war'|| projectInfo.packageType == 'spring_boot_jar'" style="color: red;">(必填)</span>工程包名称(去掉扩展名)：</td>
                                            <td>
                                                <input type="text" ng-if=" info.projectType == '0' && (projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar' )" required ng-model="projectInfo.warName" />
                                                <input type="text" ng-if=" info.projectType == '0' && (projectInfo.packageType != 'maven_war' &&  projectInfo.packageType != 'spring_boot_jar' )" ng-model="projectInfo.warName" />
                                                <span ng-show="info.projectType == '1'">{{projectInfo.warName}}</span>
                                            </td>
                                            <td><span style="color: red;">工程发布时使用的包名称</span></td>
                                        </tr>
                                        <tr ng-if="projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar' || projectInfo.packageType == 'php'">
                                            <td><span style="color: red;">(必填)</span>配置文件路径：</td>
                                            <td>
                                                <input type="text" required ng-model="projectInfo.configPath" />
                                            </td>
                                            <td><span style="color: red;">工程内配置文件的相对路径,前后不带斜杠 (／)。路径中的斜杠应使用(/)，不要使用(\)。例:java工程 sms为src/main/resources ,php工程tom为 Apps/Common/Conf</span></td>
                                        </tr>
                                        <tr>
                                            <td>工程描述：</td>
                                            <td>
                                                <input type="text" ng-model="projectInfo.projectDesc" />
                                            </td>
                                        </tr>
                                        <tr ng-if="projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar'   || projectInfo.packageType == 'maven_jar'">
                                            <td>subModule：</td>
                                            <td>
                                                <input type="text" ng-model="projectInfo.subModule" />
                                            </td>
                                            <td><span style="color: red;">当工程包括多个子工程时，发布使用war包所在的子工程名</span></td>
                                        </tr>
                                        <tr ng-if="projectInfo.packageType == 'php' || projectInfo.packageType == 'ant_android'">
                                            <td><span style="color: red;">(必填)</span>发布包名：</td>
                                            <td>
                                                <input type="text" ng-if=" info.projectType == '0' && (projectInfo.packageType == 'php' || projectInfo.packageType == 'ant_android')" required ng-model="projectInfo.packageName" />
                                                <span ng-show="info.projectType == '1'">{{projectInfo.packageName}}</span>
                                            </td>
                                            <td><span style="color: red;">工程发布压缩包名称</span></td>
                                        </tr>
                                        <tr ng-if="projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar' || projectInfo.packageType == 'php'">
                                            <td>是否使用sonar校验:</td>
                                            <td>
                                                <switch data-ng-model="projectInfo.useSonar"></switch>
                                            </td>
                                            <td></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </uib-accordion-group>
                            <br>
                            <uib-accordion-group heading="Relate Jar" is-open="true" ng-show="projectInfo.packageType == 'maven_war' || projectInfo.packageType == 'spring_boot_jar' ">
                                <input type="button" class="btn btn-info" ng-disabled="runIng" ng-click="addJarProject();" value="添加依赖jar" />
                                <br>
                                <br>
                                <span ng-repeat="i in relateJarList">
                    <div>
                        <div class="col-xs-6" style="width: 20%;">
                            <select ng-model="i.jarName" class="form-control" ng-change="jarProjectChange('{{$index}}');" ng-options="j.projectName as j.projectName for j in jarProjectList"></select>
                        </div>
                        <input style="width:400px;" type="text" ng-model="i.jarSvnUrl" disabled="disabled"/>&nbsp;&nbsp;
                        <img src="/beetle/image/icon_trash.png" ng-click="delJarProject($index);" style="cursor: pointer;width: 20px;">
                    </div><br>
                </span>
                            </uib-accordion-group>
                        </uib-accordion>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
